1. About

Plugin Info:
            Plugin version: 1.7.2.6
            Copyright (C) 2003 by Tony Topaz - ttopaz@msn.com
            Thanks to Matt Wright AKA SpHeRe3159, who contributed a major part of the FAQ and Installation section of this help file.
            This help file was prepared by Normen Stengel – normen@normen-and-troy.com
            All products mentioned are trademarks or registered trademarks of their respective manufacturers.


2. Features

Features:

- The dll can be used as regular media type plugin in myHTPC.
- It can also be activated by supplied myHTPC_Runner.exe as standalone solution.
- Support for multiple capture cards. Capture device can be selected using Capture menu item.
- Supports recording and playback of video files.
- Speed control for file playback.
- Timeshifting using SBE similar to Microsoft Media Center Edition.
    Backup files are written by default under 'C:\Documents and Settings\[login]\Application Data\myHTPCWTV\TempSBE' directory.
    This path can be changed in the Settings dialog.
- Native support for MCE remotes.
- myHTPC keys mapping support.
- Support Closed Captions (Needs VMR activated).
- Events Scheduling.
- MPEG2 Decoders supported when using WinTV-PVR:
    Default (Hauppauge)
    Sonic Cinemaster (TheaterTek)
    Elecard
    ULead (Movie Studio)
    NVidia (NVdvd player)
    InterVideo (WinDVD)
- Video/Audio Compression Codecs support when not using WinTV-PVR
- Support for TVVI and TVPI files.
- Can use EPG data from myHTPC.
- Direct support for RedRat2 or ACTiSYS IR-200L IR Blusters using OpenSource IRTuner.dll or the drivers themself.
- Shortcut key support by entry= in channels.ini
- Supports recorder (silent) mode

- PIP support for TV and playback

- Supports Deinterlace filter.
    This filter is copyright by open source project Dscaler at http://www.dscaler.com.
- Channels Tuning - Custom and fine tunning.


4. Requirements

Requirements:

  Microsoft Windows 2000 or XP
  DirectX 8.1 or better
  Hauppauge WinTV-PVR 250/350, AverMedia, WinTV PCI (Go), ATI AIW or others.
  Latest WDM drivers

Timeshifting Requirements:

  - Microsoft Windows XP SP1
  - WinTV-PVR 250/350 cards
  - Other cards need 'InterVideo Video Encoder' filter from InterVideo WinDVR or InterVideo WinDVD Recorder.
  - When InterVideo Encoder not found, DV Video Encoder will be used - high CPU usage and low fps.

Note: regular recording with non WinTV-PVR 250/350 in timeshifting mode currently doesn't work.

Client/Server Requirements:

- WinTV-PVR 250/350 card.
- 'Moonlight UDP Streaming Application' package filters from http://www.elecard.net.ru/download.
- Server needs NetRender.ax from the above package.
- Client needs NetSource.ax from the above package + one of the listed MPEG2 decoders.


3. Installation

Installation:

- Copy the myHTPC_WTV.dll file to the myHTPC directory.
- If needed, copy myHTPC_Runner.exe to the myHTPC directory.
- Copy DumpEx.ax and AsyncEx.ax to the same dir and use register.bat to register them.
- Right-click on the TV window and select your Input type.
- Use supplied myHTPC_EpgTVPIPlugin.wsc script for EPG integration. (You can find this file in the myHTPC root directory.)
- To use the deinterlace filter, copy Deinterlace.ax and regdsc.bat. Run regdsc.bat to register the filter.

Note for WinTV-PVR users:

  Some combinations of driver versions with card version having problem with preview pin.
  If having problems with the plugin, please run the runner with -configure parameter and select other then default MPEG2 decoder.
  You will need one of the listed (under Features) decoders.

Setup of Top100's TV Plugin
1.  Download and install the latest release of myHTPC. http://myhtpc.net/download/ .
2.  Open My Computer or Windows Explorer and navigate to the myHTPC folder. This should be in Program Files. Goto to the “data”
     folder, then the “tv” folder, in this make a new folder called “listings” if it is not  already.
3.  Once myHTPC is up and running, close myHTPC and select “Configure myHTPC” from the myHTPC program group on the Start Menu.
4.  Click on “my HTPC” in the tree list of the configure program.
5.  Click the little document lit-up iconon the right side towards the top,
     this will drop down a list of modules that can be added, choose TV. This creates a new TV module. You can rename it something more
     friendly like “my TV”.
6.  Click on the name of the TV module you just made, most everything can be left at their defaults. You might want to select “Use JIT recording”
     and give the “JIT recording lead time” a value of 2 or 3 seconds,  perhaps more if the channel(s) that you record tend to be offset from the
     time on your computer. Also check that the “Listings Directory” is pointing to the folder we made in step 2.
7.  Click OK and make sure to save the new settings.
8.  Obtain the latest TV Plugin. The easiest way to get up and running is to use the newest method of installing the plugin: which is an install
     program that should automatically download the      latest plugin files for you, and supports 15 languages:
     http://myhtpc.net/pub/TV%20Plugin/TV%20Plugin.exe. If it is the first time you have downloaded the plugin or a new feature has been
     added that requires the script to be updated please make sure you check the box that says 'Script for myHTPC integration' when using the
     new auto installer.
     This method is currently beta, so there may be a few issues with using it to upgrade an existing copy of the plugin or non-English installs.
9.  To avoid manually installing and setting up the program guide listings it is recommended to use fasttech's XMLTV Automate
     program: http://myhtpc.net/forum/viewtopic.php?t=1726
10. Load up myHTPC and click on the TV button that you created/renamed in step 5. Click “Live TV”. You will most likely need to
     adjust a setting or two.
11. Right click on the TV screen. Choose “Video Capture” and/or “Audio Capture” and select the device you wish to use if you
     have more than one possible source to capture from. Choose “Input” and select the correct input for your setup. To select
     the correct audio input if the sound does not play choose “Audio Settings” and select the correct audio source under the
     video input you are using. Under the “Settings” menu you will want to set the “Recorded Video Path”.
12. If you are using a card other than a Hauppauge WinTV-PVR 250/350 you will want to setup specific compression codecs
     for audio and video (for example: DivX or XviD with MP3 or Windows Media for sound.)

Further Help

Please see the “TV Plugin Help.chm” file included with the plug-in.
Also see the FAQ I have started here: http://myhtpc.net/forum/viewtopic.php?t=952&postdays=0&postorder=asc&start=645
If your issue is not resolved you can make a post to the thread about the TV Plugin here: http://myhtpc.net/forum/viewtopic.php?t=952


5. Keyboard Support

Keyboard support:

0-9…………………………...

Channel number

Ctrl-O………………………..

Open video

+, Ctrl-Up…………………...

Channel Up

-, Ctrl-Down………………...

Channel Down

/……………………………….

Last Channel

Up, Down, Left, Right……..

Navigation

Ctrl-Shift-P………………….

Play

Ctrl-P………………………..

Pause

Ctrl-Shift-S………………….

Save

Ctrl-S………………………..

Stop

Ctrl-R………………………..

Record

Ctrl-L………………………...

Live TV

Ctrl-Shift-M…………………

Menu

Ctrl-M………………………..

Mute

Shift-Up.……………………..

Volume Up

Shift-Down.………………….

Volume Down

Ctrl-Shift-F………………….

Forward

Ctrl-F………………………..

Next Clip

Ctrl-Shift-B………………….

Backward

Ctrl-B………………………..

Previous Clip

Ctrl-C…………………………

Displays Channels list for selection

Ctrl-D………………………..

Displays Channel/Playing/Recording info, press again for extended info

Ctrl-G.………………………..

Displays On-Screen Menu

Ctrl-T…………………………

Toggles Close Captions

Ctrl-1…………………………

Stretch Aspect Ratio

Ctrl-2…………………………

4x3 Aspect Ratio

Ctrl-3…………………………

16x9 Aspect Ratio

Ctrl-4…………………………

Auto Aspect Ratio

Ctrl-0…………………………

Toggle between Aspect Ratios

Backspace…………………..

Back (Hides the window)


6. Command Line Options

myHTPC_Runner.exe optional arguments:

  -dll=[dll_name]
               default is myHTPC_WTV.dll in the same directory as exe.
  -x=[x_pos] -y=[y_pos] -w=[width] -h=[height]
               when all of them are 0, just shows the window without resize.
               default is the screen size.
  -showbar=[0,1,2]
               0 - no navigation bar.
               1 - show navigation bar.
               2 - show navigation bar with Close/Back button.
               default is 2.
  -plugin=[0,1]
               0 - the EXE runs standalone.
               1 - the EXE hides and shows the tray as needed.
  -channel=[number]
               starts with given channel number.
               by default last used channel will be selected.
  -command=[command_number]
               0 - stop
               1 - play
               2 - record
  -play=[video file to play]
  -fullscreen=1
               starts in fulscreen mode
  -trace=1
               creates log of initialization in file myHTPC_WTVLog.txt, at same location as myHTPC_Runner.exe
  -configure
               opens plugin settings dialog
  -timeshifting=[0,1]
               0 - regular mode.
               1 - timeshifting mode.
  -videocapindex=[number]
               video capture device index to use
  -pvrmode=[0,1,2]
               1 - starts in PVR mode - shows myHTPC style menu on the right.
               2 - same as 1 + hides/unhides myHTPC child windows as needed.
  -commandfile=[file name]
               set tvvi or tvpi file to be used for viewing or recording.
  -recordermode=[0,1,2]
               0 - regular mode.
               1 - recorder mode - the plugin hidden and closes after recording done.
               2 - smart recorder mode - without affecting current mode.
                    (will behave like 1, if TV currently not visible)
  -inputtype=[0,1,2]
               0 = Tuner.
               1 = Composite.
               2 = Super Video.
  -hidetaskbar=[0,1]
               0 = Not hiding the taskbar (even when needs to).
               1 = (Default), hides the task bar when needed.
  -client=1
               Run in client mode.
  -server=1
               Run in server mode.

  Note: only 1 instance of myHTPC_Runner.exe will be running, but arguments will be send anyways.
  So, for example: you can change channel of the running plugin to 5 by running  'myHTPC_Runner.exe -channel=5'

  When running myHTPC_Runner.exe as program without parameters from myHTPC, the TV window will cover the screen with navbar.
  In this mode the runner will hide and show the tray bar as needed.


7. Automation Model

Frequently asked Questions:

Before you send an email, please make sure you read the entire help document.
Also be aware, that some of the feature might not work with your hardware.

Q: Where can I get the latest Version of the plugin?
A: http://www.myhtpc.net/pub/TV%20Plugin/

Q: How do I register the .ax files?
A: Download the register.bat file to the same directory as the .ax files and double click register.bat.

Q: I started the plugin and now the start menu bar is gone. What happened?
A: Start the plugin from the command line with the option –plugin=0.

Q: How can I make the plugin start in a smaller window?
A: Start the plugin from the command line with the options –x, -y, -w and –h, which describes the size and position of the window
      (x= horizontal position of upper left hand corner, y= vertical position of upper left hand corner, w = window width, h = window height)

Q: How can I start the plugin from within myHTPC?
A: You need to add the Plugin ID “myHTPC.TVPlugin” to the myHTPC TV module properties and write a little script that starts your plugin.
      A sample script can be found in the section Script Examples in this help document. There you can find a script that shows how to
      Use the TV Plugin from within myHTPC, including the EPG, using the JIT scheduler of myHTPC.

Q: I selected Closed Captioning and/or Timeshifting and it crashed. Now every time I start the plugin, it hangs. What can I do?
A: Start the plugin from the command line with the option –configure. This starts the plugin in the configuration mode. You can unselect
      Closed Captioning and/or Timeshifing. The next time you start the plugin, it should work again (if it worked before).

Q: How can I use a different recording codec?
A: To use a different codec, you must have a different codec installed on your computer. You can select the codec by right clicking on the
      Video window and selecting either video codec or audio codec .

Q: I’ve tried everything and it still doesn’t work!
A: Try to change settings for the Crossbar (right click à Properties à Crossbar) or the Preview / Capture properties.
      Change the setting in the Audio Settings dialog - use instead of all confusing Crossbar dialogs.  If you are still not
      successful, your hardware might not be compatible. Post a question in the myHTPC forum (TV Plugin section –
      http://www.myhtpc.net/forum/viewtopic.php?t=952 )

Q: What cards does the TV Plugin support?
A: The plug in should support any analog TV-tuner/capture card that has a decent WDM driver. The reference card is the Hauppauge
      WinTV PVR-250/350, which can handle MPEG2 encoding in hardware.
Other verified cards include the ASUS TV 880 (Conexant CX2388x based), just about any BT8x8 based card (ie: Zoltrix Genie TV, Pinnacle PCTV Studio Pro, older Hauppauge WinTV cards), Philips SAA713x based (ie: Compro VideoMate TV Gold Plus, LifeView FlyVideo 2000), and the ATI All-in-Wonder family.
      The TV Plugin is for analog TV only, it regrettably does not support DVB or HDTV reception.

Q: All of these instructions for manually installing the TV Plugin are confusing is there an installer?

A: Yes, forum member normen was kind enough to make an installer for the TV Plugin. The newest method of installing the plugin
is an install program that should automatically download the latest plugin files for you, and supports 15 languages: http://myhtpc.net/pub/TV%20Plugin/TV%20Plugin.exe. If it is the first time you have downloaded the plugin or a new feature has been added that requires the script to be updated please make sure you check the box that says 'Script for myHTPC integration' when using the new auto installer.

Q: Are there instructions to help me setup the TV Plugin from start to finish?

A: Yes, there is a Quick Start Guide.

Q: Does the TV Plugin support more than one tuner at a time?

A: The TV Plugin as of version 1.7.1.20 now has preliminary support for multiple TV cards, it is in the early stages of development so
      feedback is definitely encouraged.

Q: Does the TV Plugin work with Windows 98/ME?

A: The TV Plugin has now been tested with Windows 98SE and ME, please use at least version 1.7.2.6 for proper Win9x support.

Q: I need to define my channels specifically, how do I add them?

A: Please update to version 1.7.1.16 or newer as this adds the ability to define custom channels under the 'Tune Channels'
      selection. This includes the ability to specify the frequency by hand for those in the Netherlands, etc.

Q: How do I get timeshifting to work?

A: For Hauppauge PVR-250/350 users it is simply a matter of having the prerequisite of Windows XP with Service Pack 1 (as the
TV Plugin uses the Stream Buffer Engine originally created for Windows XP Media Center Edition). For others the timeshifting functions have to be done in software so an appropriate MPEG2 encoder is also needed, currently this is the "InterVideo Video Encoder" filter which is utilized in InterVideo WinDVR or InterVideo WinDVD Recorder. Additionally an MPEG2 decoder is required to see the video stream, this is very common as any DVD software includes a decoder; verified decoders include: "Default" decoder from Hauppauge, nvDVD, Ulead, Intervideo (WinDVD), Elecard, and Sonic Cinemaster (TheaterTek) decoders.

Q: Timeshifting produces quite a lag when changing channels what is that all about?

A: Timeshifting is quite a strain on a system that is doing the encoding in software. The plug-in must stop buffering the current channel
and then start buffering the new channel, this clearing of the buffer and restarting plus decoding the new MPEG2 stream is quite processor intensive hence 10 seconds of lag is quite normal.

Q: When I have myHTPC minimized and a scheduled recording starts to record, my task bar disapears. The only way i can get
it back is if I push the Windows key on my keyboard to open the start menu, then open the tvplugin, then stop the recording, and close the plug in. As soon as I close the plug in, my taskbar appears and everything is fine. Is there something I can do so my taskbar will not disapear?

A: Download the newest version of the TV Plugin a 'hidetaskbar' option has been added. Adding hidetaskbar=0 will make the TV Plugin
      not hide the taskbar between recordings:
      Open the "myHTPC_EpgTVPIPlugin.wsc" script in Notepad. Next move down towards the bottom of the script/file,and look for the following:

if (bUseSilentMode) shell.Run('"C:\\Program Files\\myHTPC\\myHTPC_Runner.exe" -recordermode=2 -x=300 -y=320 -w=460 -h=250 -commandfile="' + file_name + '"');

      now add hidetaskbar=0, so the line should look like this:

if (bUseSilentMode) shell.Run('"C:\\Program Files\\myHTPC\\myHTPC_Runner.exe" -hidetaskbar=0 -recordermode=2 -x=300 -y=320 -w=460 -h=250 -commandfile="' + file_name + '"');

      Then save the script and exit Notepad. Right-click on "myHTPC_EpgTVPIPlugin.wsc" and choose "Register"

Q: How do I setup an ACTiSYS IR-200L for use with the plug-in?

A: Do not install the Windows default IrDA driver, despite what the included manual says, as this enables the IR transmission for
computer interfacing such as syncing to a PDA or other IR device. This completely kills the remote interfacing support which is directly coded for in the remote control applications.

Go to http://sourceforge.net/projects/irtuner/and get the latest releases of the IRTuner, IRTuner Setup Utility, and the ACTiSYS IR-200L Driver. Then unzip them to a directory of choice and use the setup utility to learn your cable box remote. Go into the "Settings" menu of the TV Plugin and check the box that says "Use IRTuner compatible driver" then click the "Settings" button next to it and choose "Control IR Driver Directly" then simply point it to the "as_ir200l.dll" you got from the IRTuner website and then point it to the Remote file by default it is called "irtuner.tvr" that was created when you used the IRTuner Setup Utility. Leave everything else at their defaults except you may need to change the COM port to the correct port number that you have the Actisys connected to.

Q: When a scheduled recording starts the TV window loads and the sound plays! Why isn't it recording quietly in the
      background? or when using the quiet mode scheduled recordings have sound and no video what is going on?

A: Update to the newest TV Plugin: version 1.7.1.2 and higher have an overhaul of the recording settings. When the is TV not running
recording will start in 'silent' mode. If it is running the TV mode won't be affected and scheduled recording will be quietly added or removed. Using 'Cancel Recording...' will now cancel the appropriate scheduled event instead of blindly stopping the recording.

For those with scheduled recording blank videos; this is a known issue with certain combination video/TV-tuner cards (ie: ATI All-in-Wonder or nVidia Personal Cinema) the current fix is to turn off silent mode:
      Try removing -recordermode=2 from this line in .wsc script:
shell.Run('"C:\\Program Files\\myHTPC\\TV Plugin\\myHTPC_Runner.exe" -plugin=0 -recordermode=2 -x=300 -y=320 -w=460 -h=250 -commandfile="' + file_name + '"');

      Recording will not be silent recording anymore, but you can hit Backspace to hide it.
      For reference here is the information pertaining to old versions...
      Recording can be dealt with in a few different ways:

You can change “var bUseRecorderMode = false” to “var bUseRecorderMode = true” in the “myHTPC_EpgTVPIPlugin.wsc” script. This will let the TV Plugin handle recording in quiet mode. However just this is less than ideal as when you hit "Record this Program" the TV application will be called immediatly.
               or
      You can use the myHTPC JIT (Just in Time) feature that will call "Record This Program" right before the scheduled time.
               or
You can combine the JIT with the “var bUseRecorderMode = true” setting which will call the TV Plugin just before it is needed, and it will start it in hidden/quiet mode. This can have a side effect of suddenly hiding the TV window if you were alrady watching Live TV when the JIT kicks in to record. This can be worked around by going to the listing for the program that is currently being recorded and click "Watch Now" so you can get the TV window back to watch the show while it records.

Q: What is "VMR" and why is it usefull? VMR makes things worse why is that?

A: VMR - Video Mixing Renderer - comes in two major "flavors" VMR7 and VMR9. VMR7 was an initial trial so to speak of newer advanced
video mixing abilities using the 3D pipeline and the DirectX Video Acceleration API, it was only available in Windows XP. VMR9 is a newer, some what different, and improved VMR that comes with DirectX 9 therefore it can work on any system that can install DirectX 9, but VMR9 has more strenuous hardware requirements than VMR7 (VMR7, as you can guess, is VMR using DirectX 7 level technology.) So for VMR9 you will definitely need DX9 installed and the newest DX9 compliant drivers for your video card installed. There does not seem to be a definitive answer of what cards work with VMR9 and what do not; A fully DirectX 9 compliant video card (GeForce FX family or Radeon 9500+) is best to fully utilize VMR9; however some DirectX 8 level cards will do fine, and possibly even some DX7 level cards, providing they meet some requirements.
Since VMR9 actually uses the 3D pipeline in a graphics processor many more filtering and advanced source/stream mixing possibilities exist. This is considered the next way to display advanced video data by Microsoft, it is intended to supersede the old 2D "mapped memory" style "overlay".
VMR in general should not make things worse, if it it does, the first thing to do is to update your graphics card drivers, this has been known to help greatly; please note that older generation cards may not be fully compatible with VMR9.

Q: When timeshifting I hit record, it does not record what I think it should, it offset from what I was viewing, is this normal?

A: This is a known issue, when you are watching a program that is "timeshifted" by 30 seconds and hit "record" for a duration of 10 seconds,
the video file created features material that you won't see for another 20 seconds. In other words hitting "record", no matter what mode of the plugin you are currently in, will record Live TV not the buffered timeshifting TV.

Q: Recorded files do not have Closed Caption data, is there anything I need to setup?

A: Currently there is nothing to be done, this is an known issue.

Q: I have sound but no video, or only when I enable timeshifting do I have no video, what can I do?

A: Depending on the video card you are using it my be helpful to check "Use VMR when available" or uncheck this if it is already selected.
For timeshitfiting also make sure you have a tested decoder, for cards other than the Hauppauge PVR-250/350 the InterVideo encoder is also needed.

Q: Recording gives me audio but only black video, however Live TV works just fine what is going on?

A: Please make sure you have the latest drives for your card. For the PVR-250 please see here: http://www.shspvr.com/, this contains
      a few different driver sets including some that are known to work with Windows Media Center Edition so try some of the different versions.
If a driver update does not help: Your TV card has limited resolution for recording. Experiment with the Capture Pin resolution until you get recordings with video.
Some TV cards are even more limited: it can need the Preview Pin and Capture Pin to be set to the same resolution, what is more, some must use a low resolution like 320x240.
      Start with the Preview Pin set to 320x240 and the Capture Pin set to 320x240, see if you get recordings with video.
In the 1.7.1.0 and newer releases of the TV Plugin the capture pin is now the default preview display. By making sure this box is checked you can see in the "Live TV" view if the issues above apply and then try different resolutions and see the effect in real time.
There was an issue with timeshifting and silent recording which has similar symptoms, this issue should be fixed in version 1.7.1.10 and newer.

Q: I have wierd audio/video issues with my WinTV PVR-250/350 after using the WinTV 2000 program and then the TV Plugin, what
      can I do to fix this? or are their recommended settings for the PVR250/350?

A: WinTV 2000 resets the settings as defined in WinTV 2000.
      In order to use the TV plugin after that, this what you need to do in the TV plugin:
      1. Go to Input and select a different input than you are using and then select the correct input.
2. Go to Property Sheets->Capture, under Video Params select 'Constant Bitrate' and maybe 6MBps, under Audio Params select 192 khz for audio.

      And I would try not to use WinTV after that, who needs it when you have the TV plugin?

Q: When using a WinTV PVR-250/350 card the capture property sheet is grayed out, what do I do?
A: You are using incompatible drivers. Try a newer or different set from http://www.shspvr.com/. This site contains different driver sets
      including some that are known to work with Windows Media Center Edition so try some of the different versions.

Q: When I run the Plugin the video display is shown in another little window called the "ActiveMovie Window" which shows up
      directly underneath the main black/empty window of the plugin. What gives?

A: Please update to version 1.7.1.5 or newer, you may also need to uncheck 'Use Capture Pin for Preview' in the Settings. For PVR-250/350
owners this can also be related to a combination of the chosen MPEG2 decoder, whether closed captions are on, and whether VMR is on and which version of VMR is selected if using timeshifting.

Q: Why doesn't closed captioning work?

A: Update to 1.7.1.17 this allows captions to used in almost any mode. Previously "Use VMR when available" had to be checked first before
"Allow Closed Captions" would work. As of version 1.7.1.0 the captions can be toggled on/off using Ctrl-T. You may also have to uncheck 'Use Capure pin for Preview' in the Settings from version 1.7.1.2 and higher depending on the video card used.

Q: I have XMLTV working and it gets the listings, I've got the right directory structure setup and the output file is in the right place,
but when I go to the TV Guide I get a blank box at the top of the screen with no listings in it, what's more, the controls at the bottom of the page don't seem to work, what is going on?

A: This is not a TV Plugin issue but seems to have effected a number of new users, you are most likely missing the MSXML toolkit. Didn't you
      read the EPG documentation? or the TV Plugin Quick Setup Guide? for shame....

Q: The TV plugin goes to channel 0 even though I selected the correct listing from the EPG or my channels are all out of order and
      do not work correctly, what do I need to do to fix this?

A: This is a problem with the EPG data and not specifically the TV Plugin. This also usually effects US users only. There is a disparity between
      the EPG data and the channels.ini.
In the US this is due to the fact that Zap2it broke the format of their listings a some months ago and must "fixed" back into the accepted format that the other countries use. One common symptom of this is that the "channels.ini" file has Channel 0 written to some or all of the channel numbers entries. This "channels.ini" is what myHTPC uses to make the recording files that are handed off to the TV Plugin. The channels.ini file is found in the /data/tv/listings folder. Check to see if the channels.ini does have 0's listed by opening it in Notepad. Look for "number=0" under the channel headings.

      To deal with the EPG listings format change in the US:
The easiest way is to start using fasttech's XMLTV Automate utility which will download the listings automatically, resorts the listings; and includes the fix for the listings. The US channels fix must be activated by a checkbox under the "utilities" tab of the program.

      Alternately you can use avekevin's XMLTV_Fixer script to call from your own XMLTV batch files.

The most “power user” way is to use a search & replace utility such as the speedy little open source program "sed" it can be found here: http://gnuwin32.sourceforge.net/packages/sed.htm
      You can the use sed like this:
      sed -e "s/C\([0-9]*\)\(.*\)\.zap2it\.com/\1 \U\2\E/g" TVData.xml > TVData1.xml

      To deal with international sorting issues:
For non-US users that have channel sorting issues using the XMLTV Automate program is also recommended for its ease of use. Do not check the US listings fix as this would do nothing but waste time when writing out the listings to disk.
For an unlisted country you can add support for your country in the XMLTV Automate utility by editing a listed country's batch file: for example: Open "Run update TV listings-Denmark.bat" in Notepad and simply change all mentions of "tv_grab_dk" to the appropriate "tv_grab_" of your country. Then select Denmark as your country in XMLTV Automate.

      For those wish to do this manually you can modify your XMLTV batch file so that it calls the sort routine of XMLTV after grabbing the TV data.
      For example: xmltv tv_sort --by-channel --output xmltv\TVData.xml xmltv\TVDatapre.xml
where "TVData.xml" is the final file that you want to be copied into myHTPC listings directory, and "TVDatapre.xml" would be the temeporary file that you have the listings graber create, you will most likely need to modify the grabber commands to dump its listings to separate temporary filename first, and then at the end of the batch file you can have the temporary file deleted.

      Please note: after applying these fixes to the listings you will also need to delete the channels.ini file to have myHTPC regenerate it.

If your issue is not resolved try searching the TV Plugin forum for keywords pertaining to your problem, and finally you can make a post to the TV Plugin forum.


7. Automation Model

myHTPC_WTV.dll automation model:

Object with progid of "myHTPC_WTV.Helper" and GetTV() method can be used to get current running instance of TV Plugin (See Examples)

TV Plugin Methods:

SHORT autShowWindow(SHORT x, SHORT y, SHORT width, SHORT height);

// show and position plugin window
// when all of them are 0, just shows the window  without resize.

SHORT autHideWindow(void);

// hide the plugin

SHORT autFullScreen(void);

// go fullscreen

SHORT autShowNavBar(VARIANT_BOOL Show);

// show/hide navigation bar

SHORT autPlayFile(BSTR Name);

// play recorded file

SHORT autPlayLastRecorded(void);

// play last recorded

SHORT autRecord(LONG Duration);

// start recording, Duration in minutes, 0=no limit

SHORT autRecordToFile(BSTR Name, LONG Duration);

// record to file, Duration in minutes, 0=no limit

SHORT autStop(void);

// stop playing or recording

SHORT autMute(VARIANT_BOOL DoIt);

// mute/unmute

SHORT autClose(void);

// close the plugin

SHORT autRunEvents(BSTR Name);

// run events from .evt file

SHORT autClearEvents();

// stops and clears scheduled events

SHORT autLiveTV(void);

// goes to Live TV in timeshifting Mode

SHORT autPause(void);

// pauses TV or Playback

SHORT autSetTimeshifting(VARIANT_BOOL On);

// set timeshifting on/off

SHORT autSetVideoCaptureIndex(SHORT index);

// set video capture device index

SHORT autSetCommandFile(BSTR Name);

// set tvvi or tvpi file to be used for viewing or recording

SHORT autSetRecordingMode(SHORT iType)

// set recorder mode 0=off, 1=on, 2=smart

SHORT autSetPVRMode(SHORT mode)

// set PVR mode 1 or 2

SHORT autCancelEvent(long channel, BSTR startDate,
                                        BSTR startTime, BSTR endDate, BSTR endTime)

// cancels scheduled event.

TV Plugin Properties:

VARIANT_BOOL autIsFullScreen;

// get if fullscreen

VARIANT_BOOL autIsNavBarVisible;

// get if navigation bar visible

SHORT autInputType;

// get or set input type : 0 = Tuner, 1 = Composite, 2 = Super Video

SHORT autChannel;

// get or set current TV channel

VARIANT_BOOL autIsMute;

// get if muted

SHORT autCurrentStatus;

// get current status : 0 = Idle, 1 = Playing, 2 = Recording

VARIANT_BOOL autIsTimeshifting;

// get if timeshifting

SHORT autVideoCaptureIndex;

// returns current video capture device index

VARIANT_BOOL autRecorderMode

// get if in recorder mode


8. Script Examples

Example for Usage with the myHTPC TV Module:
(In order to use this script with the myHTPC TV Module, this script has to be registered and the Plugin ID “myHTPC.TVPlugin” has to
be added to the myHTPC TV Module properties. This script uses the WSHExtend object model. This must be installed on you computer.
Documentation and download is available at: http://ourworld.compuserve.com/homepages/Guenter_Born/WSHBazaar/WSHExtend.htm .
This script also uses the shareware program Zvolume ( http://www.shelltoys.com/volume_control/index.html ) to adjust / mute / switch
the audio input. You could use another application for this purpose with the appropriate command line parameters.)

  <?XML version="1.0"?>
  <component>
  <registration
     description="TVPlugin"
     progid="myHTPC.TVPlugin"
     version="1.00"
  >
  </registration>
  <implements id="Automation" type="Automation">
    <method name="Watch"></method>
    <method name="Record"></method>
    <method name="LiveTV"></method>
    <method name="Cancel"></method>
  </implements>
  <script language="JScript">
  <![CDATA[

  function Watch( channelID , channelDisplayNames , programTitle , programDesc , startDate , startTime , endDate , endTime , duration, channelNumber, subtitle )
  {
  //this function is called by the 'Watch Now' in the EPG butten in myHTPC.
  //var shell = new ActiveXObject( "WScript.Shell" );
    recordingduration = 0;
    filename = "";
  //calling the function AV to start TV Plugin.
    AV(channelNumber,recordingduration,filename);
    return "";
  }

  function AV( channelNumber , recordingduration , filename)
  {
  //This function starts the TV Plugin, sets the input type, selects the audio input , and starts recording
  var shell = new ActiveXObject( "WScript.Shell" );
    var tv = null;
    var tvHelper = null;
  //see if Plugin is active
    try
    {
      tvHelper = new ActiveXObject ("myHTPC_WTV.Helper");
      if (tvHelper != null)
        tv = tvHelper.GetTV();
  // See if TV Plugin is running
    }
    catch (e)
    {
    }
    if (tv == null)
    {
  //if Plugin is not active then start it
      var objAdr = new ActiveXObject("WSHExtend.WinExt");
  //this is the WSHExtend object. To run this you have to
  //have WSH Extend installed:
  //http://ourworld.compuserve.com/homepages/Guenter_Born/WSHBazaar/WSHExtend.htm
  //In the following line you would start whatever recording application you use.
      shell.Run("f:\\Progra~1\\myHTPC\\myHTPC_Runner.exe -x=1526 -y=62 -w=158 -h=105 -plugin=0 -showbar=0 -channel=" + channelNumber);
  //I use a second desktop on which myHTPC and everything happens. Here I start the plugin in a little window
  //in the upper right hand corner of the screen.
      while (tv == null)
      {
  //wait for plugin to be active
        objAdr.WSHWait (100);
        try {
               tvHelper = new ActiveXObject ("myHTPC_WTV.Helper");
                 if (tvHelper != null)
                   tv = tvHelper.GetTV();
        }
        catch (e)
        {
        }
      }
    }
  //my channel 999 comes from a satellite receiver, so I switch input to composite and set the appropriate audio input
    if (channelNumber == "999") {
      tv.autInputType = 1;
      shell.Run("f:\\Progra~1\\zvolume\\zvolume.exe /w=off /f=volume control:microphone /e");
      shell.Run("f:\\Progra~1\\zvolume\\zvolume.exe /w=on /r=40  /l=40 /f=volume control:line in /e");
    } else {
      tv.autInputType = 0;
      shell.Run("f:\\Progra~1\\zvolume\\zvolume.exe /w=off /f=volume control:line in /e");
      shell.Run("f:\\Progra~1\\zvolume\\zvolume.exe /w=on /r=70  /l=70 /f=volume control:microphone /e");
    }
  //Here I am creating the name of the recorded file out of the title, current date and time.
    dt = new Date();
    month = dt.getMonth()+1;
    day = dt.getDate();
    year = dt.getFullYear();
    hours = dt.getHours();
    minutes = dt.getMinutes();
    seconds = dt.getSeconds();
    filename = filename.replace(/\s/g, "");
    filename = filename + "-" + month + "-" +  day + "-" + year + "-" + hours + "-" + minutes + "-" + seconds;
    if (recordingduration > 0) {
  //if the duration > 0 (meaning the function is called by the record function)
  //then I start recording here
      tv.autRecordToFile("f:\\tvshows\\" + filename + ".avi", recordingduration);
    }
  //here I'm selecting the channel in case the Plugin has been running all along.
    shell.Run("f:\\Progra~1\\myHTPC\\myHTPC_Runner.exe -x=1526 -y=62 -w=158 -h=105 -plugin=0 -showbar=0 -channel=" + channelNumber);
  //and here I'm writing the window size to the registry. I have another script that I use
  //to resize the window to "almost" fullscreen using my remote control.
    shell.RegWrite ("HKCU\\Software\\Normen\\", 1 ,"REG_DWORD");
    shell.RegWrite ("HKCU\\Software\\Normen\\WindowSize","Small");
    return "";
  }

  function LiveTV( )
  {
  //this function is called by the 'Watch Now' button in the EPG in myHTPC.
    var shell = new ActiveXObject( "WScript.Shell" );
    var chN = 2; //default channell is 2
    recordingduration = 0;
    filename = "";
  //calling the AV function to start the Plugin
    AV(chN,recordingduration,filename);
  //starting the Plugin fullscreen - start your application here
    shell.Run("f:\\Progra~1\\myHTPC\\myHTPC_Runner.exe -x=1045 -y=0 -w=680 -h=480 -plugin=0 -showbar=0");
  //remembering window size
    shell.RegWrite ("HKCU\\Software\\Normen\\", 1 ,"REG_DWORD");
    shell.RegWrite ("HKCU\\Software\\Normen\\WindowSize", "Big");
    return ""
  }

  function Cancel( channelID , channelDisplayNames , programTitle , programDesc , startDate , startTime , endDate , endTime , duration , channelNumber , subtitle )
  {
  //this function is called by myHTPC when a recording in progress is being cancelled
  //first I'm checking again whether the Plugin is active, if it isn't I would otherwise start it.
    var tv = null;
    var tvHelper = null;
    var shell = new ActiveXObject( "WScript.Shell" );
    try {
      tvHelper = new ActiveXObject ("myHTPC_WTV.Helper");
      if (tvHelper != null)
        tv = tvHelper.GetTV();
    }
    catch (e)
    {
    }
    if (tv == null)
    {
    }
    else
    {
  //if it is active, I stop recording
      tvHelper = null;
      tv.autStop();
    }
    return ""
  }

  ]]>
  </script>
  <script language="VBScript">
  <![CDATA[

  function Record( channelID , channelDisplayNames , programTitle , programDesc , startDate , startTime , endDate , endTime , duration, channelNumber, subtitle )

  'this function is called by the JIT scheduler of myHTPC
  'I'm preparing the duration, call the AV function to start the Plugin for recording
    hours = Left(duration,2)
    minutes = Right(duration,2)
    recordingduration = (hours * 60 + minutes)
    filename = programTitle
    Set shell = CreateObject( "WScript.Shell" )
    AV channelNumber,recordingduration,filename
    return ""
  End Function

  ]]>
  </script>
  </component>


8. Script Examples

JScript Usage Example:

  function LiveTV( )
  {
    var tv = null;
    var tvHelper = null;
    var shell = new ActiveXObject( "WScript.Shell" );
    try
    {
        tvHelper = new ActiveXObject ("myHTPC_WTV.Helper"); // Get Helper Object
        if (tvHelper != null)
            tv = tvHelper.GetTV(); // See if TV Plugin is running
    }
    catch (e)
    {
    }
    if (tv == null)
    { // Need to run the plugin
        shell.Run( '"C:\\Program Files\\myHTPC\\myHTPC_Runner.exe" -x=500 -y=500 -w=400 -h=300 -plugin=1 -showbar=1 -channel=3', 1, false );
    }
    else
    {
        tvHelper = null;
        tv.autShowWindow(0, 0, 0, 0); // Restore the window !
        tv.autChannel = 23; // Change to channel 23
        tv.autRecordToFile("c:\\MyShows\\Program.mpg", 50); // Record for 50 minutes
    }
    return "";
}